//
//  Target_Alter.m
//  CharonTVProject
//
//  Created by karong on 2023/6/21.
//

#import "Target_Alter.h"
#import "BaseAlterController.h"
#import "WSTextFieldAlterController.h"
#import "WSTextViewAlterController.h"
#import "WSPickerAlterController.h"

@implementation Target_Alter

- (id)Action_charonTV_showAlter:(NSDictionary *)params {
    BaseAlterController * targetVC = (BaseAlterController *)[self instantiateViewControllerWithName:@"BaseAlterController"];
    if ([params.allKeys containsObject:@"titleStr"])targetVC.titleStr = params[@"titleStr"];
    if ([params.allKeys containsObject:@"content"])targetVC.contentStr = params[@"content"];
    if ([params.allKeys containsObject:@"confirm"])targetVC.confirmStr = params[@"confirm"];
    if ([params.allKeys containsObject:@"cancel"])targetVC.cancelStr = params[@"cancel"];
    targetVC.confirmHandle = params[@"confirmHandle"];
    return targetVC;
}

- (id)Action_charonTV_showTipsAlter:(NSDictionary *)params {
    BaseAlterController * targetVC = (BaseAlterController *)[self instantiateViewControllerWithStoryboardNam:@"BaseAlterController" identifier:@"WSTipsAlter"];
    if ([params.allKeys containsObject:@"titleStr"])targetVC.titleStr = params[@"titleStr"];
    if ([params.allKeys containsObject:@"content"])targetVC.contentStr = params[@"content"];
    if ([params.allKeys containsObject:@"confirm"])targetVC.confirmStr = params[@"confirm"];
    return targetVC;
}

- (id)Action_charonTV_showTextFieldAlter:(NSDictionary *)params {
    WSTextFieldAlterController * targetVC = (WSTextFieldAlterController *)[self instantiateViewControllerWithName:@"WSTextFieldAlterController"];
    if ([params.allKeys containsObject:@"titleStr"])targetVC.titleStr = params[@"titleStr"];
    if ([params.allKeys containsObject:@"content"])targetVC.contentStr = params[@"content"];
    if ([params.allKeys containsObject:@"confirm"])targetVC.confirmStr = params[@"confirm"];
    if ([params.allKeys containsObject:@"cancel"])targetVC.cancelStr = params[@"cancel"];
    targetVC.maxWordCount = [params[@"maxWordCount"] integerValue];
    targetVC.confirmHandle = params[@"confirmHandle"];
    targetVC.placeholderStr = params[@"placeholderStr"];
    return targetVC;
}

- (id)Action_charonTV_showTextViewAlter:(NSDictionary *)params {
    WSTextViewAlterController * targetVC = (WSTextViewAlterController *)[self instantiateViewControllerWithName:@"WSTextViewAlterController"];
    if ([params.allKeys containsObject:@"titleStr"])targetVC.titleStr = params[@"titleStr"];
    if ([params.allKeys containsObject:@"content"])targetVC.contentStr = params[@"content"];
    if ([params.allKeys containsObject:@"confirm"])targetVC.confirmStr = params[@"confirm"];
    if ([params.allKeys containsObject:@"cancel"])targetVC.cancelStr = params[@"cancel"];
    targetVC.maxWordCount = [params[@"maxWordCount"] integerValue];
    targetVC.confirmHandle = params[@"confirmHandle"];
    return targetVC;
}

- (id)Action_charonTV_showPickerAlter:(NSDictionary *)params {
    WSPickerAlterController * targetVC = (WSPickerAlterController *)[self instantiateViewControllerWithName:@"WSPickerAlterController"];
    if ([params.allKeys containsObject:@"title"])targetVC.titleStr = params[@"title"];
    targetVC.selectHandle = params[@"selectHandle"];
    targetVC.dataArray = params[@"dataArray"];
    return targetVC;
}

- (UIViewController *)instantiateViewControllerWithName:(NSString *)name {
   return [self instantiateViewControllerWithStoryboardNam:name identifier:name];
}

- (UIViewController *)instantiateViewControllerWithStoryboardNam:(NSString *)storyboard identifier:(NSString *)identifier{
   return [[UIStoryboard storyboardWithName:storyboard bundle:nil] instantiateViewControllerWithIdentifier:identifier];
}
@end
